#include <windows.h>
#include <tchar.h>
#include "tracelog.h"
#include "dllmain.h"
#include "log.h"
#include "ini.h"

HINSTANCE	hInstance;


BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_for_call, void* lpReserved) {
	switch (ul_reason_for_call){
		case DLL_PROCESS_ATTACH:{
			hInstance=(HINSTANCE)hInst;
			log_init();
			ini_init();
			log(_T("tracelog attach.\n"));
			break;
		}
		case DLL_PROCESS_DETACH:{
			log(_T("tracelog detach.\n"));
			tracelog_terminate();
			ini_finit();
			log_finit();
			break;
		}
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
			break;
	}
	return TRUE;
} 

HINSTANCE getInstance(){
	return hInstance;
}